#include <stdio.h>
#include <stdlib.h>


double g_balance = 0;
double g_rate = 0.01;

int menu(void){
	printf("==========================\n");
	printf("BANK\n");
	printf("==========================\n");
	printf("[1]清空\n");
	printf("[2]存款\n");
	printf("[3]取款\n");
	printf("[4]查询余额\n");
	printf("[5]利息\n");
	printf("[6]调整利率\n");
	printf("[0]推出\n");
	int select = -1;
	scanf("%d", &select);
	return select;
}


void query(void){
	printf("当前余额：%lg\n", g_balance);
}

void clear(void){
	g_balance = 0;
	query();
}

void save(void){
	printf("存款金额:\n");
	double Save;
	scanf("%lg", &Save);
	g_balance += Save;
	query();
}

void get(void){
	printf("取款余额:\n");
	double Get;
	scanf("%lg", &Get);
	if(Get > g_balance){
		printf("余额不足\n");
	}else{
		g_balance -= Get;
		query();
	}
}

void settle(void){
	g_balance *= (1 + g_rate);
	query();
}

void adjust(void){
	printf("当前利率：%lg\n", g_rate);
	scanf("%lg", &g_rate);
	printf("调整后利率：%lg\n", g_rate);
}

void quit(void){
	printf("谢谢使用\n");
	exit(0);
}

int main(void){
	for(;;){
		switch(menu()){
			case 1:
				clear();
				break;
			case 2:
				save();
				break;
			case 3:
				get();
				break;
			case 4:
				query();
				break;
			case 5:
				settle();
				break;
			case 6:
				adjust();
				break;
			case 0:
				quit();
				break;	
		}
	}
	return 0;
}
